package com.spark.trouble.handle

import android.annotation.SuppressLint
import android.os.Bundle
import android.support.v7.widget.GridLayoutManager
import android.view.View
import android.widget.ImageView
import com.blankj.utilcode.util.LogUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.google.gson.Gson
import com.spark.colliery.common.ext.gone
import com.spark.colliery.common.ext.invisible
import com.spark.common.Api
import com.spark.common.BaseFragment
import com.spark.common.Const
import com.spark.common.ext.*
import com.spark.common.helper.Picker
import com.spark.common.model.ImgUploadResultModel
import com.spark.common.model.ResultModel
import com.spark.common.net.Http
import com.spark.common.net.toJsonBody
import com.spark.trouble.R
import com.spark.trouble.model.RespUnitModel
import com.spark.trouble.model.SpotHandleSubmitModel
import com.spark.trouble.model.TroubleDealListModel
import kotlinx.android.synthetic.main.frag_deal_schema_local.*
import me.yokeyword.fragmentation.SupportFragment

/**
 *  现场治理
 */
class SpotHandleFragment : BaseFragment() {
    private lateinit var schemaImgAdapter: LocalImageAdapter
    private lateinit var acceptImgAdapter: LocalImageAdapter

    private val schemaLocal = mutableListOf<String>()
    private val acceptLocal = mutableListOf<String>()
    private val schemaCloud = mutableListOf<String>()
    private val acceptCloud = mutableListOf<String>()
    private val schemaFileId = mutableListOf<String>()
    private val acceptFileId = mutableListOf<String>()

    private lateinit var plusImgPath: String
    private var uploadModel: SpotHandleSubmitModel = SpotHandleSubmitModel()
    private var respUnitModel: RespUnitModel.ResultMap? = null
    private var prop: TroubleDealListModel.ResultMap? = null

    private val reqHTLevel = 0x1001
    private val reqUnit = 0x1002
    private var solutionType = 0

    private var canEdit: Boolean = true

    private var sourceType = 0

    companion object {
        /**
         * @param sourceType 0 -> handle 1 -> agency
         */
        fun newInstance(sourceType: Int, prop: String): SpotHandleFragment {
            val target = SpotHandleFragment()
            val args = Bundle()
            args.putString("prop", prop)
            args.putInt("sourceType", sourceType)
            target.arguments = args
            return target
        }
    }

    override fun contentResId(): Int {
        return R.layout.frag_deal_schema_local
    }

    @SuppressLint("CheckResult", "SetTextI18n")
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        arguments?.apply {
            sourceType = getInt("souceType").also {
                getString("prop")?.apply {
                    prop = Gson().fromJson(this, TroubleDealListModel.ResultMap::class.java)?.apply {
                        LogUtils.e("【sourceType】${sourceType}【prop】$prop")
                        when (sourceType) {
                            0 -> {
                                when (this.state) {
                                // 待审核/审核中
                                    "2" -> {
                                        canEdit = true
                                        fetchApproveInfo(this.task_id.toString())
                                        ll_ctrl.gone(true)
                                        btn_affirm.gone(true)
                                    }
                                // 被驳回
                                    "3" -> {
                                        canEdit = true
                                        fetchRefuseApproveInfo(this.task_id.toString())
                                    }
                                // 待归档
                                    "4" -> {
                                        canEdit = false
                                        ll_ctrl.gone(false)
                                        btn_affirm.gone(true)
                                        tv_draft.apply {
                                            text = "归档"
                                            setOnClickListener { toSave(task_id.toString(), "1") }
                                        }
                                        btn_submit.apply {
                                            text = "存入隐患历史"
                                            setOnClickListener { toSave(task_id.toString(), "2") }
                                        }
                                        fetchToSaveInfo(task_id.toString())
                                    }
                                }
                            }
                            1 -> {

                            }
                        }
                    }
                }

            }
        }

        plusImgPath = context.relAbsPath(R.drawable.img_plus_add)
        if (!schemaLocal.contains(plusImgPath)) schemaLocal.add(plusImgPath)
        if (!acceptLocal.contains(plusImgPath)) acceptLocal.add(plusImgPath)

        schemaImgAdapter = LocalImageAdapter(R.layout.item_danger_source_img).apply {
            if (!data.contains(plusImgPath)) addData(plusImgPath)
            setOnItemClickListener { adapter, view, position ->
                if (canEdit) {
                    val dataSize = adapter.data.size
                    val item = adapter.data[position]
                    if (item == plusImgPath) imgClick(position, dataSize, 0)
                    else success("点击图片【$position】")
                }
            }
            setOnItemChildClickListener { adapter, view, position ->
                val item = schemaImgAdapter.data[position]
                if (schemaLocal.contains(item)) schemaLocal.remove(item)
                if (position in 0 until schemaCloud.size - 1) {
                    schemaCloud.removeAt(position)
                    schemaFileId.removeAt(position)
                }
                if (schemaLocal.size < 9 && !schemaLocal.contains(plusImgPath)) schemaLocal.add(plusImgPath)
                schemaImgAdapter.replaceData(schemaLocal)
            }
        }
        acceptImgAdapter = LocalImageAdapter(R.layout.item_danger_source_img).apply {
            if (!data.contains(plusImgPath)) addData(plusImgPath)
            setOnItemClickListener { adapter, view, position ->
                if (canEdit) {
                    val dataSize = adapter.data.size
                    val item = adapter.data[position]
                    if (item == plusImgPath) imgClick(position, dataSize, 1)
                    else success("点击图片【$position】")
                }
            }
            setOnItemChildClickListener { adapter, view, position ->
                val item = acceptImgAdapter.data[position]
                if (acceptLocal.contains(item)) acceptLocal.remove(item)
                if (position in 0 until acceptCloud.size - 1) {
                    acceptCloud.removeAt(position)
                    acceptFileId.removeAt(position)
                }
                if (acceptLocal.size < 9 && !acceptLocal.contains(plusImgPath)) acceptLocal.add(plusImgPath)
                acceptImgAdapter.replaceData(acceptLocal)
            }
        }

        recy_accept_images.apply {
            adapter = acceptImgAdapter
            layoutManager = GridLayoutManager(context, 4)
        }
        recy_scheme_images.apply {
            adapter = schemaImgAdapter
            layoutManager = GridLayoutManager(context, 4)
        }

        // 隐患等级
        rl_hidden_trouble_level.setOnClickListener {
            if (canEdit) {
                parentFragment?.let { it as SupportFragment }?.startForResult(ChooseChoiceFragment.newInstance(ChooseChoiceFragment.htLevel), reqHTLevel)
            }
            iv_entry.invisible(!canEdit)
        }
        // 责任单位
        rl_responsible_unit.setOnClickListener {
            if (canEdit) {
                parentFragment?.let { it as SupportFragment }?.startForResult(ChooseChoiceFragment.newInstance(ChooseChoiceFragment.unit), reqUnit)
            }
            iv_entry2.invisible(!canEdit)
        }
        // 扣分
        et_lost_point.apply {
            if (canEdit)
                trackPostfix("分")
            setText("${prop?.source_score}分")
        }
        et_fine.apply {
            if (canEdit)
                trackPostfix("元")
            setText("${prop?.source_money}元")
        }
        // 罚金
        changeSchema(true)
        // 整改方案
        tv_repair_schema.setOnClickListener {
            if (canEdit) {
                changeSchema(true)
                solutionType = 0
            }
        }
        // 治理方案
        tv_handle_scheme.setOnClickListener {
            if (canEdit) {
                changeSchema(false)
                solutionType = 1
            }
        }
        // 技术员
        rl_tech_guy.setOnClickListener {}
        // 责任人
        rl_responsible_guy.setOnClickListener {}
        // 确定提交
        btn_affirm.setOnClickListener {
            submitCheck()
        }
    }

    @SuppressLint("SetTextI18n")
    private fun restore(
            htLevel: String,
            unitName: String,
            techMan: String,
            acceptMan: String,
            score: String,
            money: String,
            schemeContent: String,
            acceptContent: String,
            respMan: String,
            schemeType: Int,
            schemeImgs: MutableList<String>,
            acceptorImgs: MutableList<String>
    ) {
        tv_ht_level.text = htLevel
        tv_responsible_unit.text = unitName
        tv_tech_guy.text = techMan
        tv_accept_guy.text = acceptMan
        et_lost_point.setText("${score}分")
        et_fine.setText("${money}元")
        et_scheme_reasone.apply {
            setText(schemeContent)
            setSelection(schemeContent.length)
        }
        et_accept_reasone.apply {
            setText(acceptContent)
            setSelection(acceptContent.length)
        }
        tv_responsible_guy.text = respMan
        changeSchema(schemeType == 0)
        acceptorImgs.forEach {
            acceptImgAdapter.addData(0, it)
        }
        schemeImgs.forEach {
            schemaImgAdapter.addData(0, it)
        }
    }

    /**
     * 改变方案
     */
    private fun changeSchema(planA: Boolean) {
        tv_repair_schema.apply {
            setTextColor(if (planA) resources.getColor(R.color.color0092dfblue) else resources.getColor(R.color.color_afbcc7))
            setBackgroundResource(if (planA) R.drawable.bg_round5_frame_0092df else R.drawable.bg_round5_frame_afbcc7)
        }
        tv_handle_scheme.apply {
            setTextColor(if (!planA) resources.getColor(R.color.color0092dfblue) else resources.getColor(R.color.color_afbcc7))
            setBackgroundResource(if (!planA) R.drawable.bg_round5_frame_0092df else R.drawable.bg_round5_frame_afbcc7)
        }
    }

    override fun onFragmentResult(requestCode: Int, resultCode: Int, data: Bundle?) {
        when (requestCode) {
            reqHTLevel -> {
                if (resultCode == ChooseChoiceFragment.resHTLevel) {
                    data?.apply {
                        val level = getString("level")
                        tv_ht_level.text = level
                    }
                }
            }
            reqUnit -> {
                if (resultCode == ChooseChoiceFragment.resUnit) {
                    data?.apply {
                        Gson().fromJson(getString("unit"), RespUnitModel.ResultMap::class.java)?.apply {
                            LogUtils.e("【unit】$this")
                            tv_responsible_unit.text = this.name
                            tv_tech_guy.text = this.technicianInfo.name
                            tv_accept_guy.text = this.acceptanceInfo.name
                            tv_responsible_guy.text = this.leaderInfo.name
                            respUnitModel = this
                        }
                    }
                }
            }
        }
    }

    /**
     * @param type 0: schemaAdapter 1: acceptAdapter
     */
    private fun imgClick(position: Int, dataSize: Int, type: Int) {
        if (position == dataSize - 1) {
            activity?.apply {
                Picker(this).show {
                    LogUtils.e("【路径】$it")
                    uploadImg(it, type)
                }
            }
        } else {
            success("点击图片【$position】")
        }
    }

    @SuppressLint("CheckResult")
    private fun uploadImg(imgPath: String, type: Int) {
        Api.upload(imgPath)
                .subscribe(
                        {
                            Gson().fromJson(it, ImgUploadResultModel::class.java)?.apply {
                                if (code == "200") {
                                    if (resultMaps.isNotEmpty()) {
                                        resultMaps[0].apply {
                                            when (type) {
                                                0 -> {
                                                    if (!schemaCloud.contains(this.url)) {
                                                        schemaCloud.add(this.url)
                                                        schemaFileId.add(this.fileId.toString())
                                                    }
                                                    if (!schemaLocal.contains(imgPath)) schemaLocal.add(0, imgPath)
                                                    if (schemaLocal.size >= 9) schemaLocal.removeAt(8)
                                                    schemaImgAdapter.replaceData(schemaLocal)
                                                }
                                                1 -> {
                                                    if (!acceptCloud.contains(this.url)) {
                                                        acceptCloud.add(this.url)
                                                        acceptFileId.add(this.fileId.toString())
                                                    }
                                                    if (!acceptLocal.contains(imgPath)) acceptLocal.add(0, imgPath)
                                                    if (acceptLocal.size >= 9) acceptLocal.removeAt(8)
                                                    acceptImgAdapter.replaceData(acceptLocal)
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        {
                            hideLoader()
                            it.printStackTrace()
                            report(it)
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading("上传中...")
                        }
                )

    }

    private fun submitCheck() {
        val level = tv_ht_level.text
        if (!notify("$level", "请选择隐患等级")) {
            return
        }
        val responsibleUnit = tv_responsible_unit.text
        if (!notify("$responsibleUnit", "请选择隐患等级")) {
            return
        }
        var lostPoint = et_lost_point.text.toString()
        if (!lostPoint.isNullOrBlank() && lostPoint.contains("分"))
            lostPoint = "${lostPoint.substring(0, lostPoint.length - 1)}"
        if (!notify("$lostPoint", "请扣分")) {
            return
        }
        var fine = et_fine.text.toString()
        if (!fine.isNullOrBlank() && fine.contains("元"))
            fine = "${fine.substring(0, fine.length - 1)}"
        if (!notify("$fine", "请罚钱")) {
            return
        }
        val schemaReason = et_scheme_reasone.text
        if (schemaReason.isNullOrBlank()) {
            alert("请输入治理方案")
            return
        }
        val aceetpReason = et_accept_reasone.text
        if (aceetpReason.isNullOrBlank()) {
            alert("请输入验收依据")
            return
        }
        respUnitModel?.apply {
            if (technician_id.isNull()) {
                alert("请选择技术人员")
                return
            }
            if (acceptance_id.isNull()) {
                alert("请选择验收人员")
                return
            }
        }

        uploadModel.apply {
            this.taskId = this@SpotHandleFragment.prop?.task_id?.toString() ?: ""
            troubleLevel = level.toString()
            responsibleScore = lostPoint
            responsibleMoney = fine
            solutionContent = schemaReason.toString()
            solutionFields = schemaFileId.append(",")
            acceptContent = aceetpReason.toString()
            acceptFields = acceptFileId.append(",")
            technicaianId = respUnitModel?.technician_id?.toString() ?: "0"
            acceptanceId = respUnitModel?.acceptance_id?.toString() ?: "0"
            leaderId = respUnitModel?.leader_id?.toString() ?: "0"
            solutionTime = sdf().format(System.currentTimeMillis())
            solutionPlan = solutionType.toString()
            processorId = respUnitModel?.processor_id?.toString() ?: "0"
            troubleDepartmentId = respUnitModel?.department_id?.toString() ?: "0"

        }
        submit()
    }

    private fun notify(orign: String, notifyStr: String): Boolean {
        if (orign.isNullOrBlank() || orign == "请选择") {
            alert(notifyStr)
            return false
        }
        return true
    }

    /**
     * 待处理任务
     * 审核驳回重新治理
     */
    @SuppressLint("CheckResult")
    private fun submit() {
        val params = mutableMapOf(
                "taskId" to uploadModel.taskId,
                "troubleLevel" to uploadModel.troubleLevel,
                "troubleDepartmentId" to uploadModel.troubleDepartmentId,
                "responsibleScore" to uploadModel.responsibleScore,
                "responsibleMoney" to uploadModel.responsibleMoney,
                "solutionFileIds" to uploadModel.solutionFields,
                "solutionContent" to uploadModel.solutionContent,
                "acceptContent" to uploadModel.acceptContent,
                "acceptFileIds" to uploadModel.acceptFields,
                "processorId" to uploadModel.processorId,
                "technicianId" to uploadModel.technicaianId,
                "acceptanceId" to uploadModel.acceptanceId,
                "leaderId" to uploadModel.leaderId,
                "sulotionTime" to uploadModel.solutionTime,
                "solutionPlan" to uploadModel.solutionPlan
        )
        Http.request()
                .rxPost("${Const.base_url}${Const.act_submit_spot_handle}", params.toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            Gson().fromJson(it, SpotHandleSubmitResultModel::class.java)?.apply {
                                if (code == "200") {
                                    toast("提交成功")
                                    activity?.finish()
                                }
                            }
                        },
                        {
                            it.printStackTrace()
                            report(it)
                            hideLoader()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading("提交中...")
                        }
                )
    }

    /**
     * 获取审核中状态的信息
     */
    @SuppressLint("CheckResult")
    private fun fetchApproveInfo(taskId: String) {
        val params = mutableMapOf("taskId" to taskId)
        Http.request()
                .rxPost("${Const.base_url}${Const.act_spot_handle_chking}", params.toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            Gson().fromJson(it, SpotHandleChkingModel::class.java)?.apply {
                                if (code == "200" && resultMaps.isNotEmpty()) {
                                    resultMaps[0].apply {
                                        restore(
                                                trouble_level,
                                                departmentName,
                                                technician_name,
                                                acceptor_name,
                                                responsible_score.toString(),
                                                responsible_money.toString(),
                                                solution_content,
                                                accept_reason,
                                                responsible_user_name,
                                                solution_type,
                                                solutionPICInfo.map { it.uri }.toMutableList(),
                                                acceptionPICinfo.map { it.uri }.toMutableList()
                                        )
                                    }
                                }
                            }
                        },
                        {
                            it.printStackTrace()
                            report(it)
                            hideLoader()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading()
                        }
                )
    }

    /**
     * 获取待存储状态的信息
     */
    @SuppressLint("CheckResult")
    private fun fetchToSaveInfo(taskId: String) {
        Http.request()
                .rxPost("${Const.base_url}${Const.act_spot_handle_to_save}", mutableMapOf("taskId" to taskId).toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            Gson().fromJson(it, SpotHandleToSaveModel::class.java)?.apply {
                                if (code == "200" && resultMaps.isNotEmpty()) {
                                    resultMaps[0].apply {
                                        restore(
                                                trouble_level,
                                                departmentName,
                                                technician_name,
                                                acceptor_name,
                                                responsible_score.toString(),
                                                responsible_money.toString(),
                                                solution_content,
                                                accept_reason,
                                                responsible_user_name,
                                                solution_type,
                                                mutableListOf(),
                                                mutableListOf()
                                        )
                                    }
                                }
                            }
                        },
                        {
                            it.printStackTrace()
                            report(it)
                            hideLoader()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading()
                        }
                )
    }

    /**
     * 被驳回[重新治理]信息
     */
    @SuppressLint("CheckResult")
    private fun fetchRefuseApproveInfo(taskId: String) {
        Http.request()
                .rxPost("${Const.base_url}${Const.act_ht_rehandle}", mutableMapOf("taskId" to taskId).toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            Gson().fromJson(it, RejectApproveModel::class.java)?.apply {
                                if (code == "200" && resultMaps.isNotEmpty()) {
                                    resultMaps[0].apply {
                                        restore(
                                                trouble_level,
                                                departmentName,
                                                technician_name,
                                                acceptor_name,
                                                responsible_score.toString(),
                                                responsible_money.toString(),
                                                solution_content,
                                                accept_reason,
                                                responsible_user_name,
                                                solution_type,
                                                mutableListOf(),
                                                mutableListOf()
                                        )
                                    }
                                }
                            }
                        },
                        {
                            it.printStackTrace()
                            report(it)
                            hideLoader()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading()
                        }
                )
    }

    @SuppressLint("CheckResult")
    private fun toSave(taskId: String, saveType: String) {
        val params = mutableMapOf(
                "taskId" to taskId,
                "saveType" to saveType)
        Http.request()
                .rxPost("${Const.base_url}${Const.act_to_save}", params.toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            Gson().fromJson(it, ResultModel::class.java)?.apply {
                                if (code == "200") {
                                    success("提交成功")
                                } else {
                                    error("提交失败")
                                }
                            }
                        },
                        {
                            hideLoader()
                            report(it)
                            it.printStackTrace()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading("提交中...")
                        }
                )
    }

    /**
     * [待办] 待审核
     * @param approveState 待审核状态 1 -> 驳回 2 -> 通过
     */
    @SuppressLint("CheckResult")
    private fun submitAgencyVerify(taskId: String, approveState: String) {
        val params = mutableMapOf("taskId" to taskId, "approveState" to approveState)
        Http.request()
                .rxPost("${Const.base_url}${Const.act_agency_spot_submit_verify}", params.toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            LogUtils.e(it)
                        },
                        {
                            it.printStackTrace()
                            report(it)
                            hideLoader()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading("提交中...")
                        }
                )
    }

    /**
     * [待办] 待审核
     */
    @SuppressLint("CheckResult")
    private fun fetchAgencyVerify(taskId: String) {
        Http.request()
                .rxPost("${Const.base_url}${Const.act_agency_spot_fetch_verify}", mutableMapOf("taskId" to taskId).toJsonBody())
                .wrapIO()
                .subscribe(
                        {
                            LogUtils.e(it)
                        },
                        {
                            it.printStackTrace()
                            report(it)
                            hideLoader()
                        },
                        {
                            hideLoader()
                        },
                        {
                            dispose = it
                            loading()
                        }
                )
    }
}


class LocalImageAdapter(layoutRes: Int) : BaseQuickAdapter<String, BaseViewHolder>(layoutRes) {
    override fun convert(helper: BaseViewHolder?, item: String?) {
        if (item == null) return
        helper?.apply {
            val iv = getView<ImageView>(R.id.iv_danger_img)
            if (item == mContext.relAbsPath(R.drawable.img_plus_add))
                iv.setImageResource(R.drawable.img_plus_add)
            else
                iv.local(item)
            getView<ImageView>(R.id.iv_delete).apply {
                gone(mContext.relAbsPath(R.drawable.img_plus_add) == item)
                setOnClickListener {
                    onItemChildClickListener?.onItemChildClick(this@LocalImageAdapter, it, adapterPosition)
                }
            }
        }
    }

}

/**
 * 提交结果
 */
data class SpotHandleSubmitResultModel(
        var msg: String = "", // 成功
        var code: String = "", // 200
        var data: Any = Any(), // null
        var resultMaps: List<ResultMap> = listOf()
) {

    data class ResultMap(
            var departmentName: String = "", // 通风安全科
            var leaderName: String = "", // 闫老师
            var techicianName: String = "", // 张峰
            var processorName: String = "", // 袁建
            var acceptanceName: String = "" // 任建
    )
}


data class SpotHandleChkingModel(
        var msg: String = "", // 成功
        var code: String = "", // 200
        var data: Any = Any(), // null
        var resultMaps: List<ResultMap> = listOf()
) {

    data class ResultMap(
            var departmentName: String = "", // 铜川福美煤矿
            var trouble_level: String = "", // 轻警
            var solution_type: Int = 0, // 0
            var solutionPICInfo: List<SolutionPICInfo> = listOf(),
            var accept_reason: String = "", // wer
            var responsible_money: Double = 0.0, // 150.00
            var responsible_user_name: String = "", // 袁建
            var responsible_score: Int = 0, // 12
            var acceptor_name: String = "", // 任建
            var acceptionPICinfo: List<AcceptionPICinfo> = listOf(),
            var solution_content: String = "", // qwe
            var responsible_department_id: Int = 0, // 23
            var technician_name: String = "" // 张峰
    ) {

        data class AcceptionPICinfo(
                var filename: String = "", // 1533153786785.jpg
                var uri: String = "", // /upload/1533153786785.jpg
                var fileId: Int = 0 // 12387
        )


        data class SolutionPICInfo(
                var filename: String = "", // 1533153786907.jpg
                var uri: String = "", // /upload/1533153786907.jpg
                var fileId: Int = 0 // 12388
        )
    }
}


data class SpotHandleToSaveModel(
        var msg: String = "", // 成功
        var code: String = "", // 200
        var data: Any = Any(), // null
        var resultMaps: List<ResultMap> = listOf()
) {

    data class ResultMap(
            var departmentName: String = "", // 机电安全科
            var trouble_level: String = "", // 无警
            var responsible_money: Int = 0, // 200
            var solution_type: Int = 0, // 0
            var responsible_user_name: String = "", // 袁建
            var responsible_score: Int = 0, // 3
            var acceptor_name: String = "", // 任建
            var accept_reason: String = "", // 080
            var solution_content: String = "", // 868
            var responsible_department_id: Int = 0, // 24
            var technician_name: String = "" // 张峰
    )
}


data class RejectApproveModel(
        var msg: String = "", // 成功
        var code: String = "", // 200
        var data: Any = Any(), // null
        var resultMaps: List<ResultMap> = listOf()
) {

    data class ResultMap(
            var departmentName: String = "", // 通风安全科
            var approve_remark: String = "", // asdada
            var trouble_level: String = "", // 轻警
            var responsible_money: Int = 0, // 200
            var solution_type: Int = 0, // 0
            var responsible_user_name: String = "", // 袁建
            var responsible_score: Int = 0, // 3
            var acceptor_name: String = "", // 任建
            var accept_reason: String = "", // qweq
            var solution_content: String = "", // qweq
            var responsible_department_id: Int = 0, // 25
            var technician_name: String = "" // 张峰
    )
}

